Find an item in a list by LINQ

150

linq where in list -

var allowedStatus = new[]{ "A", "B", "C" };
var filteredOrders = orders.Order.Where(o => allowedStatus.Contains(o.StatusCode));

Find an item in a list by LINQ -

string search = "lookforme";
 List<string> myList = new List<string>();
 string result = myList.Single(s => s == search);

from where in list linq -

var filteredOrders = from order in orders.Order
                     where allowedStatus.Contains(order.StatusCode)
                     select order;

Comments

Submit
0 Comments